import requests
import json
import time
from datetime import datetime
def get_today_date():
    today = datetime.now()
    return today.strftime('%Y%m%d')
today_date = get_today_date()
url = 'https://dgutfk.dgut.edu.cn/dg-ccl/visitor/addSubscribeInfo'
headers = {
    'Host': 'dgutfk.dgut.edu.cn',
    'Connection': 'keep-alive',
    'Accept': 'application/json, text/plain, */*',
    'Authorization': '',#这里填你登录的授权cookies
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090c11)XWEB/11275',
    'Content-Type': 'application/json',
    'Origin': 'https://dgutfk.dgut.edu.cn',
    'Sec-Fetch-Site': 'same-origin',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Dest': 'empty',
    'Referer': 'https://dgutfk.dgut.edu.cn/dg-ccl/',
    'Accept-Encoding': 'gzip, deflate, br',
    'Accept-Language': 'zh-CN,zh;q=0.9'
}
data = {
    "schoolArea": "松山湖校区",#如果你是莞城的，那就填“莞城校区”
    "name": "",#姓名
    "phone": "",#填你的真实手机号
    "idCard": "",#填你的真实身份证
    "admissionType": "0",
    "carNo": "",#这里填你的车牌号码：例如粤S88888
    "department": "",#在校学生
    "reasons": "",#临时停车
    "remark": "",
    "appendixFileUrl": "",
    "userType": "2",
    "openId": "",#这里填你的openid，实在找不到就进小程序抓包
    "departmentCustomerUserno": "",
    "startTime": f"{today_date}000000",
    "endTime": f"{today_date}235900",
    "intervieweeId": None,
    "visitorNum": 1,
    "province": "",
    "visitorQuestionnaire": {},
    "entrance": 1
}
response = requests.post(url, headers=headers, json=data)
print(response.text)
time.sleep(10)